package util;

import org.junit.Test;

import java.math.BigInteger;
import java.util.Arrays;

public class Computer {

    BigInteger GWei_1 = new BigInteger("1000000000");
    BigInteger ETH_1 = new BigInteger("1000000000000000000");

    BigInteger usd_eth_rate = new BigInteger("20394").divide(new BigInteger("100"));

    BigInteger fastRate = new BigInteger("91").multiply(GWei_1);
    BigInteger stableRate = new BigInteger("67").multiply(GWei_1);
    BigInteger lowRate = new BigInteger("41").multiply(GWei_1);

    @Test
    public void gasTest() {

        String[] gasUsed = {"2117357", "351335", "102302", "65193", "28145"};
        String[] stableAns = new String[5];
        for (int i = 0; i < gasUsed.length; i++) {
            BigInteger gasUsedStage = new BigInteger(gasUsed[i]);
            BigInteger tmp = gasUsedStage.multiply(stableRate).multiply(usd_eth_rate).divide(ETH_1);
            stableAns[i] = tmp.toString();
        }

        System.out.println(Arrays.asList(stableAns));
    }

    @Test
    public void gas() {
        int[] numb = {1032,351,276,633,260};
        for (int i = 0; i < numb.length; i++) {
            double ans = numb[i] * 241 * 3 * 0.00001;
            System.out.println(ans);
        }
    }

}